﻿using System;
using System.Data;
using System.Data.SqlClient;
using System.Data.SqlTypes;
using Microsoft.SqlServer.Server;

namespace PickGold.SqlServer
{
	/// <summary>
	/// Any
	/// </summary>
	[Serializable]
	[SqlUserDefinedType(Format.Native)]
	public struct Any : INullable
	{
		private object _Any;

		/// <summary>
		/// Any
		/// </summary>
		public Any(object any)
		{
			this._Any = any;
		}

		/// <summary>
		/// 返回表示当前 System.Object 的 System.String。
		/// </summary>
		/// <returns></returns>
		public override string ToString()
		{
			if (this._Any == null)
				return null;

			return this._Any.ToString();
		}

		/// <summary>
		/// 指示结构是否为 null。此属性为只读。
		/// </summary>
		public bool IsNull
		{
			get
			{
				if (this._Any == null)
					return true;

				return false;
			}
		}

		/// <summary>
		/// Null
		/// </summary>
		public static Any Null
		{
			get
			{
				return new Any();
			}
		}

		/// <summary>
		/// Parse
		/// </summary>
		/// <param name="s">SqlString</param>
		/// <returns></returns>
		public static Any Parse(SqlString s)
		{
			if (s.IsNull)
				return Any.Null;

			var any = new Any();
			return any;
		}

		/// <summary>
		/// 这是占位符方法
		/// </summary>
		/// <returns></returns>
		public string Method1()
		{
			//在此处插入方法代码
			return "Hello";
		}

		/// <summary>
		/// 这是占位符静态方法
		/// </summary>
		/// <returns></returns>
		public static SqlString Method2()
		{
			//在此处插入方法代码
			return new SqlString("Hello");
		}
	}
}
